package com.game.view.component.dropItem
{
	import base.BaseHero;
	
	import com.dusk.util.ResUtil;
	
	import flash.display.MovieClip;
	
	public class DropMedicine extends DropItemBase
	{
		
		public static var PEACH:String = "peach";
		
		public static var MAGIC_BOTTLE:String = "magicBottle";
		
		public static var CARROT:String = "carrot";
		
		public function DropMedicine()
		{
			super();
		}
		
		public function setType(itemType:String):void
		{
			var texture:MovieClip = ResUtil.getComponentView("dropItem_" + itemType) as MovieClip;
			texture.x = texture.y = 0;
			addChild(texture);
			switch (itemType)
			{
				case PEACH:
					addPickFunc(pickPeach);
					break;
				case MAGIC_BOTTLE:
					addPickFunc(pickMagicBottle);
					break;
				case CARROT:
					addPickFunc(pickCarrot);
					break;
			}
		}
		
		private function pickPeach(bh:BaseHero):void
		{
			bh.cureHp(bh.getHpMax() * 0.25);
			bh.cureHp(bh.getHpMax() * 0.25);
		}
		
		private function pickMagicBottle(bh:BaseHero):void
		{
			bh.cureMp(bh.getMpMax() * 0.25);
		}
		
		private function pickCarrot(bh:BaseHero):void
		{
			bh.cureHp(bh.getHpMax() * 0.25);
		}
	}
}
